<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/static/commons/taglibs.jsp"%>
<%@ include file="/static/commons/meta.jsp"%>
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 	<title>${title }</title>
	<!--自定义index样式-->
	<link rel="stylesheet" href="${ctx }/static/styles/basic/basic.css" ></link>
	<link rel="stylesheet" href="${ctx }/static/styles/edit/box.css" ></link>
	<!--js库-->
	<%@ include file="/static/commons/jquery-easyui.jsp" %>
	<script type="text/javascript" src="${ctx}/static/widgets/easyui/plugins/jquery.draggable.js"></script>
	<script type="text/javascript" src="${ctx}/static/widgets/easyui/plugins/jquery.droppable.js"></script>
	<script type="text/javascript" src="${ctx}/static/widgets/easyui/plugins/jquery.tree.js"></script>
	<script type="text/javascript" src="${ctx}/static/scripts/set_select.js"></script>
	<script type="text/javascript" src="${ctx}/static/scripts/util.js"></script>
  </head>
  
  <body style="padding-bottom:8px;">
  		<c:set var="em" value="<span>*</span>"></c:set>
  		<c:set var="disabled" value=""></c:set>
  		<c:set var="ifSelect" value=""></c:set>
  		<c:set var="noChange" value=""></c:set>
  		<c:set var="isExist" value="true"></c:set>
  		<c:set var="isImportant" value="true"></c:set>
  		<c:if test="${not empty view}">
  			<c:set var="disabled" value="disabled"></c:set>
  			<c:set var="ifSelect" value="false"></c:set>
  			<c:set var="em" value=""></c:set>
  			<c:set var="isImportant" value=""></c:set>
  		</c:if>
  		<c:if test="${not empty user.user_id}">
	  		<c:set var="noChange" value="disabled"></c:set>
	  		<c:set var="isExist" value=""></c:set>
  		</c:if>
  		<form id="editForm" action="${ctx}/user/save" method="post">
  			<input type="hidden" value="${user.user_id}" id="old_userId" name="p_old_userId" ></input>
  			<div class="box">
	  			<table>
	  				<tbody>
	  					<tr>
	  						<td class="message">
								<p><span>*</span>用户帐号：</p>
							</td>
							<td colspan="1">
								<c:choose>
									<c:when test="${empty user.user_id }">
										<input type="text" id="userId" name="p_userId" value="${user.user_id }"
											class="wd170 " maxLength="20" ${disabled } style="width: 100%;" ></input>
									</c:when>
									<c:otherwise>
										<input type="text" value="${user.user_id }"
											class="wd170 " maxLength="20"  disabled  style="width: 100%;" ></input>
										<input type="hidden" id="userId" name="p_userId" value="${user.user_id }"
											class="wd170 " maxLength="20"   style="width: 100%;" ></input>
									</c:otherwise>
								</c:choose>
							</td>
							<td class="message">
								<p><span>*</span>用户姓名：</p>
							</td>
							<td colspan="1">
								<input type="text" id="userName" name="p_userName" value="${user.user_name }"
									class="wd170 " maxLength="20" style="width: 100%;" ></input>
							</td>
		  				</tr>
		  				<tr>
		  					<td class="message">
								<p><span>*</span>登录密码：</p>
							</td>
							<td colspan="1">
								<input type="password" id="password" name="p_password" value="${user.password }"
									class="wd170 " maxLength="20" style="width: 100%;" ></input>
							</td>
							<td class="message">
								<p><span>*</span>确认密码：</p>
							</td>
							<td colspan="1">
								<input type="password" id="password2" name="p_password2" value="${user.password }"
									class="wd170 " maxLength="20" style="width: 100%;" ></input>
							</td>
		  				</tr>
		  				<tr>
		  					<td class="message">
								<p><span>*</span>归属部门：</p>
							</td>
							<td colspan="1">
								<vvise:select id="deptId" name="p_deptId" sqlname="getDeptByUser" className="wd170" width="99%"
	  								defval="${user.dept_id}" default="false" ifTree="true" sqlparam="${LoginUser.deptId}"
	  								 ifSelect="${ifSelect}" />
							</td>
							<td class="message">
								<p><span>*</span>性别：</p>
							</td>
							<td colspan="1">
								<vvise:select id="sex" name="p_sex" sqlname="getCodeData" className="wd170" width="99%"
	  								defval="${user.sex}" sqlparam="sex" default="false" ifSelect="${ifSelect}" />
							</td>
		  				</tr>
		  				<tr>
		  					<td class="message">
								<p>电话：</p>
							</td>
							<td colspan="1">
								<input type="text" id="linkPhone" name="p_linkPhone" value="${user.link_phone }"
									class="wd170 " maxLength="20" style="width: 100%;" ${disabled} ></input>
							</td>
							<td class="message">
								<p>状态：</p>
							</td>
							<td colspan="1">
								<vvise:select id="status" name="p_status" sqlname="getCodeData" className="wd170" width="99%"
	  								defval="${user.status}" sqlparam="data_status" default="false" ifSelect="${ifSelect}" />
							</td>
		  				</tr>
		  				<tr>
		  					<td class="message">
								<p>身份证号：</p>
							</td>
							<td colspan="1">
								<input type="text" id="idCard" name="p_idCard" value="${user.id_card }"
									class="wd170 " maxLength="18" style="width: 100%;" ${disabled} ></input>
							</td>
							<td class="message">
								<p>紧急联系人：</p>
							</td>
							<td colspan="1">
								<input type="text" id="emergencyUser" name="p_emergencyUser" value="${user.emergency_user }"
									class="wd170 " maxLength="20" style="width: 100%;" ${disabled} ></input>
							</td>
						</tr>
						<tr>
		  					<td class="message">
								<p>紧急联系人电话：</p>
							</td>
							<td colspan="1">
								<input type="text" id="emergencyContact" name="p_emergencyContact" value="${user.emergency_contact }"
									class="wd170 " maxLength="20" style="width: 100%;" ${disabled} ></input>
							</td>
							<td class="message">
								<p>与紧急联系人关系：</p>
							</td>
							<td colspan="1">
								<input type="text" id="emergencyRel" name="p_emergencyRel" value="${user.emergency_rel }"
									class="wd170 " maxLength="20" style="width: 100%;" ${disabled} ></input>
							</td>
						</tr>
	  				</tbody>
	  			</table>
		  		<!-- 弹簧菜单 -->
		  		<div class="shrinkage_menu">
		  			<!-- single -->
		  			<h1 class="shrinkage_t click_this_down" onclick="show_hide_cont(this)">角色权限</h1>
	  				<div class="shrinkage_c">
	  					<c:choose>
	  						<c:when test="${fn:length(roleList) > 0}">
	  							<c:forEach items="${roleList}" var="role" varStatus="i">
				  					<div class="shrinkage_checked 
				  						<c:if test="${not empty role.flag}"> shrinkage_checked_bg </c:if>">
				  						<input type="checkbox" id="role_${i.index}" name="p_roleId" value="${role.role_id}"  ${disabled}
										 	<c:if test="${not empty role.flag}"> checked="true"</c:if> ></input>
				  						<label for="role_${i.index}" style="cursor: pointer;" title="${role.role_name}">${role.role_name}</label>
				  					</div>
			  					</c:forEach>
			  					<div class="clear_both"></div>
			  				</c:when>
		  					<c:otherwise>
		  						<span class="shrinkage_no_data">无</span>
		  					</c:otherwise>
	  					</c:choose>
	  				</div>
		  		</div>
	  		</div>
	  		<!-- 弹簧菜单 结束 -->
        </form>
        <script type="text/javascript">
        $(function(){
        	$('#accountId').focus();
        	$('.shrinkage_t:first').click();
        	$('.shrinkage_c input:checkbox').click(function(){
        		var this_statu = $(this).attr('checked');
        		var this_bg_obj = $(this).parent();
        		//多选 多选备用 请勿删除
        		if(this_statu){
        			this_bg_obj.addClass('shrinkage_checked_bg');
        		}else{
        			this_bg_obj.removeClass('shrinkage_checked_bg');
        		}
        		//*/
        	});
        });
        function show_hide_cont(this_obj){
        	var this_self = $(this_obj);
        	var this_cont = this_self.next();
        	if(this_cont.is(':hidden')){
        		$('.shrinkage_c').slideUp(100);
        		this_cont.slideDown(100);
        		this_self.removeClass('click_this_down');
        		this_self.addClass('hide_this_up');
        	}else{
        		this_cont.slideUp(100);
        		this_self.removeClass('hide_this_up');
        		this_self.addClass('click_this_down');
        	}
        }
        </script>
  </body>
</html>